<template>
  <div>
    <el-row :gutter="20" :class="$style.header">
      <el-col :span="4">标题：
        <el-input v-model="terms.title" placeholder="请输入标题" style="width:71%" @keyup.enter.native="handleSearch"></el-input>
      </el-col>
      <el-col :span="3">
        <el-button type="primary" @click="handleSearch">搜索</el-button>
        <el-button @click="$router.push('/personnal-manage/mobileMsg-management/add')">增加</el-button>
      </el-col>
    </el-row>
    <el-table :data="capital" border style="width: 100%" @selection-change="handleSearch">
      <el-table-column v-for="(item,index) in capitalTit" :key="index" :prop="item.prop" :label="item.label" :min-width="item.width">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="small"
            @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
          <el-button
            size="small"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div style="margin: 30px 0;">
      <el-pagination @current-change="handleCurrentChange" :page-size="pageSize" layout="prev, pager, next, jumper" :total="total">
      </el-pagination>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      id: this.$route.params.id,
      terms: {
        title: '',
        },
      capitalTit:[{
          prop: 'cTitle',
          label: 'id',
          width: '50'
        },
        {
          prop: 'fTze',
          label: '标题',
          width: '300'
        },
        {
          prop: 'fNlx',
          label: '内容',
          width: '100'
        },
        {
          prop: 'cQixian',
          label: '添加时间',
          width: '100'
        },
        {
          prop: 'cQixian',
          label: '是否可用',
          width: '100'
        },
      ],
      capital: [],
      total: 0,
      pageSize: 10,
    }
  },
  methods: {
    handleEdit(index,val){

    },
    handleDelete(index,val){

    },
    handleSearch(){
      this.getTableDate(1)
    },
    handleCurrentChange(val) {
      this.getTableDate(val)
    },
    getTableDate(page = 1) {
      this.$get(this, {
        api: 'member/loadBid.do', data: {
          fUid: this.id,
          pageSize: this.pageSize,
          page
        }
      }).then(({ data }) => {
        if (data.state === 0) {
          if (page == 1) {
            this.total = data.content.num;
          }
          //标的类型{5:转贷宝,6:温商宝,7:新手标,8:债权转让,9:福利标,10:个人借贷,11:车车贷,12:财智标,13:保证金,15:安存宝}16商户通
          data.content.data.forEach(function(obj) {
            if (obj.fBlx == 5) obj.fBlx = "转贷宝"
            if (obj.fBlx == 6) obj.fBlx = "温商宝"
            if (obj.fBlx == 7) obj.fBlx = "新手标"
            if (obj.fBlx == 8) obj.fBlx = "债权转让"
            if (obj.fBlx == 9) obj.fBlx = "福利标"
            if (obj.fBlx == 10) obj.fBlx = "个人借贷"
            if (obj.fBlx == 11) obj.fBlx = "车车贷"
            if (obj.fBlx == 12) obj.fBlx = "财智标"
            if (obj.fBlx == 13) obj.fBlx = "保证金"
            if (obj.fBlx == 15) obj.fBlx = "安存宝"
            if (obj.fBlx == 16) obj.fBlx = "商户通"
          }, this);
          this.capital = data.content.data;
        } else {
          this.$toast({
            message: data.message
          })
        }
      })
    }
  },
  mounted() {
    // this.getTableDate(1);
  }
}
</script>

<style lang="scss" module>
.header {
  font-size: 14px;
  padding-bottom: 20px;
}
</style>


